const request = (baseUrl, method = 'GET', params) => {
    return new Promise((resolve, reject) => {
        wx.request({
            url: baseUrl,
            method,
            data: params,
            header: {
                'content-type': 'application/json'
            },
            success: (res) => {
                if (res.data.code === 'OK' || res.data.code === 'SUCCESS') {
                    resolve(res.data.data);
                } else {
                    reject({ msg: res.data.msg || res.data.errorMessage });
                }
            },
            fail: (err) => {
                reject(err);
            }
        });
    });
};

// 添加企业微信好友状态
const addFriendStatus = (url, method, params) => {
    return new Promise((resolve, reject) => {
        request(url, method, params)
            .then((res) => {
                resolve(res);
            })
            .catch((err) => {
                reject(err);
            });
    });
};
export { addFriendStatus };
